<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page language="java" pageEncoding="UTF-8" %>
<%@page import="com.yinhai.core.common.api.config.impl.SysConfig" %>
<%@page import="com.yinhai.core.common.api.base.IConstants" %>
<%@page import="com.yinhai.modules.authority.api.vo.MenuVo" %>
<%@page import="com.yinhai.modules.org.api.vo.position.PositionVo" %>
<%@page import="com.yinhai.modules.org.api.vo.user.UserVo" %>
<%@page import="com.yinhai.modules.org.ta3.domain.po.IPosition" %>
<%@page import="com.yinhai.modules.security.api.util.SecurityUtil" %>
<%@page import="com.yinhai.modules.security.api.vo.UserAccountInfo" %>
<%@page import="org.springframework.web.servlet.support.RequestContext" %>
<%@page import="java.util.ArrayList" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Map" %>
<%@ page import="com.alibaba.fastjson.JSON" %>
<%@ page import="com.alibaba.fastjson.serializer.PropertyFilter" %>
<%@ page import="com.alibaba.fastjson.serializer.SerializerFeature" %>
<%
    String curPageUrl = request.getRequestURI();
    curPageUrl = curPageUrl.substring(curPageUrl.lastIndexOf("/") + 1);
%>
<%@ include file="/ta/inc-path.jsp" %>

<%
    RequestContext rc = new RequestContext(request);
%>
<script type="text/javascript">
    var basePath = "<%=basePath%>";
    var developMode = <%=SysConfig.getSysConfig("developMode")%>;
</script>
<%
    //String fixPath = "true".equals(AppManager.getSysConfig("true"))?"min.":"";
    UserAccountInfo userAccountInfo = SecurityUtil.getUserAccountInfo(request);
    UserVo user = userAccountInfo.getUser();

    if (user == null) {
        response.sendRedirect("login.jsp");
        return;
    }
    //String menuType = AppManager.getSysConfig("menuType");
    String menuType = "window";
    //String useLevelOneMenu = AppManager.getSysConfig("useLevelOneMenu");
    String useLevelOneMenu = "true";

    List menuList = (List) request.getAttribute("menuList");

    //创建PropertyFilter对象，并重载apply方法
    PropertyFilter propertyFilter = new PropertyFilter() {
        boolean flag = true;
        public boolean apply(Object obj, String name, Object value) {
            if (name.equalsIgnoreCase("parent") || name.equalsIgnoreCase("root")) {
                flag = false;
            } else {
                flag = true;
            }
            return flag;
        }

    };
    String menuJson = JSON.toJSONString(menuList, propertyFilter, SerializerFeature.WriteSlashAsSpecial);
//	List firstMenuChild = new ArrayList();
//	Map firstMenu = new HashMap();
//	Map secMenu = new HashMap();
//	Map thMenu = new HashMap();
//	if(menuList != null && menuList.size()>0){
//		if(useLevelOneMenu.equals("true")){
//			firstMenu = (Map)menuList.get(0);
//			if(menuList.size()>1){
//				secMenu = (Map)menuList.get(1);
//			}else{
//				secMenu = (Map)menuList.get(0);
//			}
//			if(menuList.size()>2){
//				thMenu = (Map)menuList.get(2);
//			}else{
//				thMenu = (Map)menuList.get(0);
//			}
//			firstMenuChild = (List)firstMenu.get("childNode");
//		}else{
//			firstMenuChild = menuList;
//		}
//	}

    String curRoleName = userAccountInfo.getNowPosition() == null ? "无岗位" : userAccountInfo.getNowPosition().getPositionname();
    List<PositionVo> positions = SecurityUtil.getCurrentUserPositions(session);
    String perPos = IPosition.POSITION_TYPE_PERSON;
    PositionVo mainPosition = userAccountInfo.getNowPosition();
    long nowPosId = mainPosition.getPositionid();
    PositionVo p;
    String signstate = (String) session.getAttribute("signstate");
%>
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="X-UA-Compatible" content="IE=8; IE=9; IE=10"/>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>消息服务平台</title>
    <link href="<%=basePath %>indexue/common/indexBase.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" type="text/css" id="bluecolor_indextab" href="<%=basePath%>indexue/css/nowcolor/nowcolor.css"/>
    <link rel="stylesheet" type="text/css" href="<%=facePath%>support/bubblepopup/bubblepopup.css"/>
    <link rel="stylesheet" type="text/css" id="linkskin" href="<%=facePath%>ta3Index.css"/>
    <link rel="stylesheet" type="text/css" href="<%=basePath%>indexue/common/menuIcons.css"/>
    <script src="<%=facePath%>support/jquery/jquery-1.11.0.min.js" type="text/javascript"></script>
    <script src="<%=facePath%>support/bubblepopup/bubblepopup.v2.3.1.min.js" type="text/javascript"></script>
    <script src="<%=facePath%>ta3Index.js" type="text/javascript"></script>
    <script src="<%=basePath %>indexue/js/horizontalMenu.js" type="text/javascript"></script>
    <script src="<%=basePath %>indexue/js/leftMenu.js"></script>
    <script src="<%=basePath %>indexue/js/index-tab.js"></script>
    <script src="<%=basePath %>indexue/js/passwordCheck.js"></script>

    <%--&lt;%&ndash;引入项目主页覆盖文件&ndash;%&gt;--%>
    <%--<link rel="stylesheet" type="text/css" href="${basePath}indexue/project_cover/index_cover/index_cover.css" />--%>
    <%--&lt;%&ndash;引入项目主页js功能覆盖文件&ndash;%&gt;--%>
    <%--<script src="${basePath}indexue/project_cover/index_cover/index_cover.js" type="text/javascript"></script>--%>

    <script type="text/javascript">
        window.baseGlobvar = {};
        window.baseGlobvar.contextPath = '<%=request.getContextPath()%>';
        window.baseGlobvar.basePath = '<%=basePath%>';
        window.baseGlobvar.curPageUrl = '<%=curPageUrl%>';
        <%-- 	window.baseGlobvar.developMode = '<%=AppManager.getSysConfig("developMode")%>';
        window.baseGlobvar.pageSize = '<%=AppManager.getSysConfig("pageSize")%>';
        window.baseGlobvar.cols_360 = '<%=AppManager.getSysConfig("cols_360")%>';
        window.baseGlobvar.columnsWidthsOverView = '<%=AppManager.getSysConfig("columnsWidthsOverView")%>';--%>
        window.baseGlobvar.indexStyle = '<%=session.getAttribute(IConstants.INDEX_STYLE)%>';
        //lins jquery 1.8- 的兼容方案
        jQuery.browser = {};
        jQuery.browser.mozilla = /firefox/.test(navigator.userAgent.toLowerCase());
        jQuery.browser.webkit = /webkit/.test(navigator.userAgent.toLowerCase());
        jQuery.browser.opera = /opera/.test(navigator.userAgent.toLowerCase());
        jQuery.browser.msie11 = /rv:11.0/.test(navigator.userAgent.toLowerCase());
        jQuery.browser.msie = /msie/.test(navigator.userAgent.toLowerCase()) || jQuery.browser.msie11;
    </script>
    <script src="<%=facePath%>support/i18n/i18n.js" type="text/javascript"></script>
    <script src="indexue/loginresource/js/RSA.js" type="text/javascript"></script>
    <script src="indexue/loginresource/js/BigInt.js" type="text/javascript"></script>
    <script src="indexue/loginresource/js/Barrett.js" type="text/javascript"></script>

</head>
<body style="padding: 0px; margin: 0px; overflow: hidden;" id="body">
<!-- topMenu start -->
<div id="topMenuStart" class="horizontal_menu">
    <div id="topMenuImgLogo" class="homepage_log">
        <%=com.yinhai.modules.i18n.util.I18nUtil.getMessage("logo", "logo")%>
    </div>
    <div id="horizontalMenu" class="homepage_menu">
        <div class="item_more" id="item_more" onclick="setMoreMenu(menuList)">...</div>
    </div>
    <div class="homepage_info">
        <div>
            <!-- 国际化 start  -->
            <%
                if (SysConfig.getSysConfigToBoolean("isOpenI18n", false)) {
            %>
            <div class="international">
                <a href="#" id="zh_CN" onclick="changeLocale(this)"
                   key-i18n="{i18ntext:'taface.page.index.ele.language.china'}"></a>|
                <a href="#" id="en_US" onclick="changeLocale(this)"
                   key-i18n="{i18ntext:'taface.page.index.ele.language.english'}"></a>
            </div>
            <%
                }
            %>
            <!-- 国际化  end -->

            <!-- 帮助提示 start  -->
            <div id="reHelpTip_div" onclick="reDirect()" key-i18n="{i18ntext:'taface.page.index.ele.helptip'}"></div>
            <!-- 帮助提示 end  -->

            <!-- 用户信息 start  -->
            <div id="loginUser"
                 onclick="showUserInfo('<%=user.getLoginid()%>', '<%=mainPosition.getPositionname()%>', <%=signstate%>);">
                <img id="loginUserImg01"
                     src="<%=basePath %>indexue/images/top_icon_person.png">
                </img>
                <div class="loginUser_in"></div>
                <img id="loginUserImg02"
                     src="<%=basePath %>indexue/images/top_icon_person_arrow.png">
                </img>
            </div>
            <!-- 用户信息 end  -->
            <%--退出 start--%>
            <div class="outSystem" onclick="logoutDwr()">
                <img src="<%=basePath %>indexue/images/top_icon_close.png"><span
                    key-i18n="{i18ntext:'taface.page.index.ele.quit'}"></span>
            </div>
            <%--退出 end--%>
        </div>
    </div>
</div>
<!-- topMenu end -->
<div class="center_content">

    <!-- leftMenu start -->
    <div id="menuBody" class="menuBody"></div>
    <!-- leftMenu end -->
    <!-- headCenter start -->
    <div id="csi_index_tab_iframe">
        <div class="csi_index_tabs">
            <div style="float: left; height: 30px; width: 96px;">
                <div id="tab_01" class="csi_index_menuTab"
                     style="height: 100%; width: 100%;" title="我的首页"
                     onclick="fnIndexBtnClick()" _id="01">
                    <div class="gztClick"
                         style="cursor: pointer; height: 26px; margin-top: 4px; line-height: 26px; font-size: 14px; text-align: center;">
                        工作台
                    </div>
                </div>
            </div>
            <div id="bc_tabs" style="float: left; height: 30px;">
                <ul id="csi_indexTabs">
                    <li onclick="IndexTabCsi.showTabList(this);"
                        class="csi_index_icon" id="csi_tabListIcon"
                        style="display: none;">
                        <div class="csi_index_tab_div"></div>
                    </li>
                </ul>
            </div>
        </div>
        <ul class="csi_index_tab_list" id="csi_index_tabList">
            <li class="csi_close_all"
                onclick="IndexTabCsi.closeAllTab();fnIndexBtnClick();"><span>关闭所有</span>
            </li>
            <li title="工作台"
                onclick="fnIndexBtnClick();$('#csi_index_tabList').fadeOut();"
                id="l_01"><span>工作台</span></li>
        </ul>
        <div class="iframe_main" id="mainFrameBox"
             style="float: left; position: relative;">
            <iframe name="tab_b_01" frameborder=no
                    src="<%=basePath %>sysapp/portalAction.do"
                    id="tab_b_01" style="width: 100%; height: 100%"></iframe>
        </div>
    </div>
    <!-- headCenter end -->
    <!--左侧菜单拖动控制条 -->
    <div id="menuDragBar"></div>
</div>
<!-- password update start -->
<div class="panel panelnomargin window"
     style="display: none; width: 400px; height: 166px; z-index: 9005; cursor: default; position: absolute;"
     id="passC">
    <div class="panel-header panel-header-noborder window-header"
         style="width: 400px;">
        <div class="panel-title" style="cursor: move;">修改密码</div>
        <div class="panel-tool">
            <div class="panel-tool-close" onclick="fnClosePass()">X</div>
        </div>
    </div>
    <div id="passInfo"
         class="grid   panel-body panel-body-noborder window-body"
         layout="column" cols="1"
         style="padding: 0px; width: 400px; height: 140px;" title="">
        <div class="fielddiv fielddiv_163"
             style="margin: 1px 5px !important;">
            <label for="oldPass" class="fieldLabel"> <span
                    style="color: red">*</span> 原密码
            </label>
            <div class="fielddiv2">
                <input type="password" id="oldPass" name="dto['oldPass']"
                       required="true"
                       class="textinput validatebox-text validatebox-invalid"
                       validtype="length[0,15]" onkeypress="return fnCheckOldPass(this);">
            </div>
        </div>
        <div class="fielddiv fielddiv_163" style="margin: 5px;">
            <label for="newPass" class="fieldLabel"> <span
                    style="color: red">*</span> 登录口令
            </label>
            <div class="fielddiv2">
                <input type="password" id="newPass" name="dto['newPass']"
                       required="true" class="textinput validatebox-text"
                       validtype="length[0,15]" onkeypress="return fnCheckNewPass(this);">
            </div>
        </div>
        <div class="fielddiv fielddiv_163" style="margin: 5px;">
            <label for="rpassword" class="fieldLabel"> <span
                    style="color: red">*</span> 确认口令
            </label>
            <div class="fielddiv2">
                <input type="password" id="rpassword" name="dto['rpassword']"
                       required="true" class="textinput validatebox-text"
                       validtype="compare(this.value, ['=', 'newPass'])" onkeypress="return fnCheckNewPass(this);">
            </div>
        </div>
        <div id="tabuttonlayout_div" class="button-panel center"
             style="border-top: 1px solid #c6c6c6; background-color: #FAFAFA">
            <button id="saveUserBtn" class="sexybutton_163" type="button"
                    onclick="fnSavePass();" value="">
                <span class="button_span isok"> 保存</span>
            </button>
            <button id="closeWinBtn" class="sexybutton_163" type="button"
                    onclick="fnClosePass()" value="">
                <span class="button_span "> 关闭</span>
            </button>
        </div>

        <div style="clear: both"></div>
    </div>
</div>

<!-- password update end -->
<!-- roles change start -->
<div class="position_menu" id="roles" style="width: 200px;">
    <ul style="width: auto;padding: 5px 0px;">
        <%
            for (int i = 0; i < positions.size(); i++) {
                p = positions.get(i);
        %>
        <li id="p_<%=p.getPositionid()%>" _id="<%=p.getPositiontype()%>" _name="<%=p.getPositionname() %>"
            onclick="fnSelectPosition(this)">
            <%
                if (nowPosId == p.getPositionid()) {
            %>
            <span class="pos-now"
                  title="组织路径：<%=p.getOrgnamepath()%>"><%=p.getPositionname() %><%if ("1".equals(p.getPositiontype())) {%>(公有)<%} else if ("2".equals(p.getPositiontype())) {%>(个人)<%} else if ("3".equals(p.getPositiontype())) {%>(委派)<%} %></span>
            <%} else {%>
            <span title="组织路径：<%=p.getOrgnamepath()%>"><%=p.getPositionname() %><%if ("1".equals(p.getPositiontype())) {%>(公有)<%} else if ("2".equals(p.getPositiontype())) {%>(个人)<%} else if ("3".equals(p.getPositiontype())) {%>(委派)<%} %></span>
            <%} %>
        </li>
        <%} %>
    </ul>
</div>
<!-- roles change end -->
</body>
<script>
    $(document).ready(function () {
        fnCheckMenu();
        fnInitPage();
        $(window).resize(fnInitPage);
        bindEvent();
        fnPageGuide();
        bodyRSA();
    });
    var key;
    function bodyRSA() {
        setMaxDigits(130);
        key = new RSAKeyPair("10001", "", "906C793510FB049452764740B21B97A51DAEA794AB6E43836269D5E6317D49226C12362BA22DAB5EC3BC79553A8A098B01F3C4D81A87B3EE5BD2F4F1431CC495EE2FE54688B212145BB32D56EEEEE1430CE26234331B291CFC53C9B84FAFFDF0B44371A032880C3D567F588D2CD5FCE28D9CDD2923CB547DAD219A6A1B8B5D3D");
    }


    function fnCheckMenu() {
        if ("[]" == "<%=menuList%>") {
            alert("没有授予任何菜单权限,请联系管理员授权后再登陆");
            return;
        }
    }
    function fnPageGuide() {
        var data;
        if ("<%=useLevelOneMenu%>" == "true") {
            data = [{
                id: $("#loginUser"),
                message: "这里能修改当前登录账户的密码！"
            }, {
                id: $("#reHelpTip_div"),
                message: "这里可以重新进行引导"
            }];
        }
        else {
            data = [{
                id: $("#loginUser"),
                message: "这里可以进行换肤操作!"
            }];
        }
        ;
        new TaHelpTip($("#topMenuStart")).helpTip({
            replay: false,
            show: true,
            cookname: currentBuinessId,
            data: data
        });
    }

    function reDirect() {
        //Base.msgTopTip("<div class='msgTopTip'>重新导航成功</div>")
        if (window.frames["tab_b_" + currentBuinessId].window.$(".hint-tips").length > 0) {
            return;
        }
        $.clearCookieHintArray(currentBuinessId);
        if (currentBuinessId != "01") {
            var fun = window.frames["tab_b_" + currentBuinessId].window.fnPageGuide;
            if (fun && typeof(fun) == "function") {
                window.frames["tab_b_" + currentBuinessId].window.fnPageGuide(currentBuinessId);
            } else {
                alert("该页面没有引导");
            }
// 			window.frames["tab_b_"+currentBuinessId].window.fnPageGuide();
// 			window.fnPageGuide();
        } else {
            fnPageGuide();
        }
    }

    function changeLocale(div) {
        $.ajax({
            url: 'i18n/changeLocale.do?langType=' + div.id,
            type: 'POST',
            success: function (data) {
                location.reload();
            }
        });
    }

    function fnSetCommonMenu() {
        IndexTab.actTab("01", true);
        $("#used_menu").fadeOut();
    }

    function fnSelectPosition(o) {
        var $o = $(o);
        if (confirm("确认切换岗位吗？")) {
            var positionid = $o.attr("id").substring(2);
            $.ajax({
                "data": "__positionId=" + positionid,
                "url": "commonAction.do",
                "success": function (data) {
                    $("#loginUser .loginUser_in").html($(o).attr("_name"));
                    $("#selectPosition").hide();
                    $(".position_menu").hide();
                },
                "type": "POST",
                "dataType": "json"
            });
            //更改菜单样式
            $o.parent("ul").find("span").removeClass('pos-now');
            $o.find("span").addClass('pos-now');
        } else {
            $("#selectPosition").hide();
        }
    }

    var s;
    //给左边菜单栏绑定鼠标移入事件，移入后显示下级菜单
    function bindEvent() {
        $("#menu_ul li").mouseenter(
                function () {
                    var o = this;
                    s = setTimeout(function () {
                        var id = $(o).attr("id");
                        $(o).siblings().each(function () {
                            if ($(this).attr("childMenu")) {
                                hideChildMenu(this);
                            }
                        });
                        if ($(o).attr("childMenu")
                                && $(o).attr("childMenu") != "null") {
                            if ($("#menu_container_" + id).size() > 0) {
                                showChildMenu(o);
                            } else {
                                initChildMenu(o);
                            }
                        }
                    }, 200);
                }).mouseleave(function (e) {
            clearTimeout(s);
            s = null;
        });
        //当鼠标点击非弹出菜单处，菜单消失
        $(document).mousedown(
                function (e) {
                    var ev = e ? e : $.event.fix(window.event || e);
                    var target = ev.target || ev.srcElement;
                    // $("#userInfoPlan").hide();
                    if (target.id != "mgContainer" && target.parentElement.id != "mgContainer" && !$(target).hasClass("used_menu_name")) {
                        $("#msb_menu").fadeOut();
                    }
                });

        $(document).mousedown(function (e) {
            var target = e.srcElement || e.target;
            if (!($(target).attr("id") == "roles" || $(target).parents("#roles").length > 0)) {
                $("#roles").hide();
            }
        })
    }
    ;
    //隐藏弹出菜单方法
    function hideChildMenu(o) {
        var $menu = $("#menu_container_" + $(o).attr("id"));
        $menu.hide();
    }
    //左边菜单展开收起事件
    $(function () {
        $("#menuLevel2").click(function (e) {
            menuToBig(this);
            e.stopImmediatePropagation();
        }).hover(
                function (e) {
                    if ($(this).hasClass("arrow_right")) {
                        $(this).removeClass("arrow_right").addClass(
                                "arrow_right_over");
                        $("#menuLevel2_middle").show();
                        $("#menuLevel2_small").show();
                    } else {
                        $(this).removeClass("arrow_left").addClass("arrow_left_over");
                    }
                },
                function () {
                    if ($(this).hasClass("arrow_right_over")) {
                        $(this).removeClass("arrow_right_over").addClass("arrow_right");
                        $("#menuLevel2_middle").hide();
                        $("#menuLevel2_small").hide();
                    } else {
                        $(this).removeClass("arrow_left_over").addClass("arrow_left");
                    }
                });

        $("#menuLevel2_middle").click(function (e) {
            menuToMiddle();
            e.stopImmediatePropagation();
        });

        $("#menuLevel2_small").click(function (e) {
            menuToSmall();
            e.stopImmediatePropagation();
        });
        //打开常用菜单面板事件
        $("#commonMenu").click(function (e) {
            var box = $("#used_menu");
            if (box.css("display") == "none") {
                box.fadeIn();
            } else {
                box.fadeOut();
            }
            $("#func_menu").fadeOut();
        });
        //打开用户功能面板事件
        $("#user_func_menu").click(function (e) {
            var box = $("#func_menu");
            if (box.css("display") == "none") {
                box.fadeIn();
            } else {
                box.fadeOut();
            }
            $("#used_menu").fadeOut();
        });
    });

    window.onload = function () {
        /********************绑定接收数据事件**********************/
        if (window.attachEvent) {
            window.attachEvent("onmessage", receiveMsg);
        } else {
            window.addEventListener("message", receiveMsg, true);
        }
    };
    //消息事件回调函数
    function receiveMsg(e) {
        e = e || window.event;
        var o = eval("(" + e.data + ")");
        var msg = o.msg;
        if (o.type == "function") {
            var fun = eval(o.msg);
            var args = o.args || [];
            if (typeof args == "string") {
                args = args.split(";");
            }
            if (typeof fun == "function")
                fun.apply(fun, args);
        }
        //处理session过期刷页面
        if (o._sessiontimeout) {
            logoutDwr();
        }
    }
    //获取常用菜单
    function getCommonMenu() {
        $.ajax({
            "url": "<%=basePath%>commonMenuAction.do",
            "success": function (data) {
                var menuC = data;
                if (menuC) {
                    var menu_comm = [];
                    for (var i = 0; i < menuC.length; i++) {

                        menu_comm.push("<div class='positionClass'>");
                        menu_comm.push("<div class='threeMenuImg'>");
                        //menu_comm.push(		"<img src='indexue/images/threemenuimg.png' style='  margin-top: 12px;' />");
                        menu_comm.push("</div>");
                        menu_comm.push("<div style='float:left;margin-left:6px;height:100%;'>");
                        menu_comm.push("<span title='" + menuC[i].menuname + "' class='menuNames'>" + menuC[i].menuname + "</span>");
                        menu_comm.push("<span id='" + menuC[i].menuid + "' style='display:none;' class='csimenu_url'>" + menuC[i].url + "</span>");
                        menu_comm.push("</div>");
                        menu_comm.push("</div>");
                    }
                    $(".mtlb").html(menu_comm.join(''));
                    $(".positionClass").mouseenter(function () {
                        $(this).addClass("divoverClass");
                        $(this).find("div[class='threeMenuImg']").addClass("threeMenuImg1");
                    }).mouseleave(function () {
                        $(this).removeClass("divoverClass");
                        $(this).find("div[class='threeMenuImg threeMenuImg1']").removeClass("threeMenuImg1");
                    }).click(function () {
                        var $span1 = $(this).find("span").eq(0);
                        var $span2 = $(this).find("span[class='csimenu_url']");
                        IndexTabCsi.addTab($span2.attr("id"), $span1.text(), $span2.text(), function () {
                        });
                        $("#menuThreeLevel").hide();
                    });
                }
                var menuAdd = [];
                menuAdd.push("<div id='csi_menuAdd' style='  float: left;  padding-top: 20px;height:80px;width:100%;'>");
                menuAdd.push("<div title='常用菜单添加删除' class='csi_m_a'></div>");
                menuAdd.push("</div>");
                $(".mtlb").append(menuAdd.join(''));
                $("#csi_menuAdd").click(function () {
                    IndexTabCsi.actTab("01", true);
                    $("#tab_01").find("div").addClass("gztClick");
                    window.frames["tab_b_01"].window.fnAddCommonMenu();
                });
            },
            "type": "POST",
            "dataType": "json"
        });

    }
    //设置常用菜单
    function fnSetCommonMenuCsi() {
        IndexTabCsi.actTab("01", true);
        //window.frames["tab_b_01"].window.fnAddCommonMenu();
        $("#used_menu").show();
    }
    //打开修改密码窗口
    function openPwChangeWindow() {
        var h = $(window).outerHeight(true);
        var w = $(window).outerWidth(true);
        var $pass = $("#passC");
        $("body").append("<div class='window-mask' style='width:" + w + "px;height:" + h + "px'></div>")
        $pass.css({"top": (h - $pass.height()) / 2, "left": (w - $pass.width()) / 2}).show();
        $("#oldPass").focus();
        $("#passInfo").find("input").val("");
        $("#func_menu").fadeOut();
    }
    //关闭修改密码窗口
    function fnClosePass() {
        $("#passC").hide();
        $("div.window-mask").remove();
    }
    //保存密码
    function fnSavePass() {
        var oldPass = $("#oldPass").val();
        var newPass = $("#newPass").val();
        var rpassword = $("#rpassword").val();
        if (oldPass == "") {
            alert("原密码不能为空！");
            return;
        }
        if (newPass == "") {
            alert("新密码不能为空！");
            return;
        }
        //密码复杂度检查
        var complexityMsg = checkPwdComplexity(newPass);
        if (complexityMsg && complexityMsg.length > 0) {
            alert(complexityMsg);
            return;
        }
        if (rpassword == "") {
            alert("密码确认不能为空！");
            return;
        }
        if (newPass != rpassword) {
            alert("两次输入的密码不一致，请检查！");
            return;
        }

        <%if ("true".equals(SysConfig.getSysConfig("passwordRSA", "false"))) {%>
        oldPass = encryptPwd(oldPass);
        newPass = encryptPwd(newPass);
        <%} %>

        var d = "dto['oldPass']=" + oldPass + "&dto['newPass']=" + newPass
                + "&indexChangePass=1";
        $.ajax({
            "url": "<%=basePath%>indexAction!changePassword.do",
            "data": d,
            "success": function (data) {
                if (data.resultMessage) {
                    alert(data.resultMessage.message);
                    if (data.resultMessage.messageType != "error") {
                        fnClosePass();
                    }
                } else {
                    fnClosePass();
                }
            },
            "type": "POST",
            "dataType": "json"
        });
    }
    function encryptPwd(pwd) {
        return encryptedString(key, encodeURI(pwd));
    }

    function rightPartControl(state) {
        if (state == "hide") {//如果右边菜单隐藏
            $("#csi_index_tab_iframe").animate({"padding-left": "0px"});

        } else {
            $("#csi_index_tab_iframe").animate({"padding-left": "140px"});

        }
        fnInitPage();
    }

    function _fnCloseMenu() {
        /*if(lm)lm.hideLeftMenu();*/
    }
    function fnAddCommonMenuCsi() {
        Base.openWindow("addWin", "添加常用菜单", "<%=basePath%>sysapp/commonMenuAction!toAddCommonMenus.do", {}, 400, 450, null, function () {
            location.href = location.href;
        }, true);
    }
    $("#csi_tabListIcon").hide();
    var menuList = '<%=menuJson%>';
    menuList = eval(menuList);
    setHorizontalMenu(menuList);
    var loginUserName = "<%=mainPosition.getPositionname()%>";
    setLoginUserName(loginUserName);
    //modify by xp 无权限用户，界面完整展示调整
    var leftMenuList = menuList.length ? menuList[0].childNode : [];
    var lm = new LeftMenu(leftMenuList, rightPartControl);
    lm.init(leftMenuList);
    function getSecMenu(menuId) {
        $(".item_menu").removeClass("active");
        $("#" + menuId).addClass("active");
        $(".homepage_menu").attr("data-active", menuId);
//        $(".img").each(function() {
//            $(this).attr("src",$(this).attr("src").replace(/\_/g,""));
//        });
//        var src = $("#"+menuId+" > img")[0].src;//.replace(".png","_.png"); //yanglq
//        $("#"+menuId+"> img").removeAttr("src").attr("src", src);

        menuClickId = menuId;
        var secMenu = null;
        var menuObj = null;
        if (menuList.length > 0) {
            for (var i = 0; i < menuList.length; i++) {
                if (menuList[i].menuId == menuId) {
                    secMenu = menuList[i].childNode;
                    menuObj = menuList[i];
                    break;
                }
            }
        }
        if (menuObj.url) {
            IndexTabCsi.addTab(menuObj.menuId, menuObj.menuName, menuObj.url,
                    function () {
                    });
        }
        if (!secMenu)secMenu = [];
        lm.setMenuLevelTwo(secMenu);
    }
    $("#tab_01").click(function () {
        if ($(this).find("div").hasClass("gztClick")) {
        } else {
            $(this).find("div").addClass("gztClick");
        }
    });

    //签到 签退
    function signRecordOut() {
        $.ajax({
            "url": "<%=basePath%>signrecord/signRecordAction!signstate.do?sign=out",
            "data": {},
            "success": function (obj) {
                var msg = obj.fieldData.signmsg;
                if (msg == "out_success") {
                    alert("签退成功");
                    $("#signout").hide();
                    $("#signin").show();
                } else if (msg == "out_fail") {
                    alert("签退失败");
                }
            },
            "type": "POST",
            "dataType": "json"
        });
    }
    function signRecordIn() {
        $.ajax({
            "url": "<%=basePath%>signrecord/signRecordAction!signstate.do?sign=in",
            "data": {},
            "success": function (obj) {
                var msg = obj.fieldData.signmsg;
                if (msg == "in_success") {
                    alert("签到成功");
                    $("#signout").show();
                    $("#signin").hide();
                } else if (msg == "in_fail") {
                    alert("签到失败");
                }
            },
            "type": "POST",
            "dataType": "json"
        });
    }
    //xiepan 注销 【弃用，启用新方法logoutDwr】
    function logout() {
        window.location.href = "<%=request.getContextPath()%>/j_spring_cas_security_logout";
    }

    function logoutDwr() {
        <%--top.location = "<%=request.getContextPath()%>/logout";--%>
        window.location.href = "<%=request.getContextPath()%>/j_spring_cas_security_logout?ret_url=<%=request.getContextPath()%>";
    }
    //end MG yanglq
    //start 修改密码长度控制 xp
    $("#oldPass,#newPass,#rpassword").CreateBubblePopup({
        selectable: false,
        alwaysVisible: false,
        innerHtml: "密码最大长度为50",
        divStyle: {'z-index': 9005},
        mouseOver: "hide",
        themePath: '<%=facePath%>support/bubblepopup/img'
    });
    //onkeypress
    function fnCheckOldPass(o) {
        return checkLengthOnkeypress(o, 50, "");
    }
    //onkeypress
    function fnCheckNewPass(o) {
        return checkLengthOnkeypress(o, 50, "");
    }

    //控制输入字符长度
    var timer;//定时器
    var delay = 800;//延迟时间
    function checkLengthOnkeypress(target, l, classname) {
        //控制长度
        if (!checkPwdLengthOnkeypress(target, l)) {
            toNotice(target, classname, "输入已达长度限制，不能继续输入！");
            timer = setTimeout(function () {
                clearNotice(target);
            }, delay);
            return false;
        } else {
            return true;
        }
    }
    function clearNotice(target) {
        $(target).HideBubblePopup();
        timer = null;
    }
    function toNotice(target, classname, msg) {
        if (timer) {
            clearTimeout(timer);
        } else {
            $(target).ShowBubblePopup();
        }
    }
    //end 修改密码长度控制 xp

    // aolei add 岗位切换
    function showPositionSwitch() {
        $("#userInfoPlan").css("display", "none");
        var top = $("#loginUser").offset().top + 50;
        var left = $("#loginUser").offset().left - 40;
        $("#roles").css("top", top);
        $("#roles").css("left", left);
        $("#roles").show();

    }
</script>
</html>
<%-- <%@ include file="/ta/incfooter.jsp"%> --%>
